<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" import="java.util.List,com.telecom.cms.dto.CimPage"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean"
	prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html"
	prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic"
	prefix="logic"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<html>
	<head>
		<title>JSP for SysTeamForm form</title>
		<LINK href="css/default.css" rel=stylesheet>
		<LINK href="css/button.css" rel=stylesheet>
		<script src="js/prototype.js"></script>
		<script language="javascript" type="text/javascript">
		function opchange(pageid){
		document.custviewForm.method.value=o;
		document.custviewForm.submit();
		}
		
		function geninfo(pageid)
{
<%
 List cimpagelist=(List)request.getAttribute("cimpagelist");
 CimPage inst=null;
 for (int i=0;i<cimpagelist.size();i++)
 {
    inst=(CimPage)cimpagelist.get(i);
    out.print("$('id"+inst.getPageId()+"').style.display='none';");
    }
 inst=(CimPage)cimpagelist.get(0);
%>
$("execing").style.display="none";
//alert("dd"+$("id"+pageid).innerHTML+"s");
if($("id"+pageid).innerHTML==""){//if info has been got,it will not been got again
    $("execing").style.display="block";
	var url = '/tcms/custview.do';
	var pars = "method=getinfo&pageid="+pageid+"&custid=<%=request.getAttribute("custid")%>";
	var myAjax = new Ajax.Request(
	url,
	{
	method: 'get',
	parameters: pars,
	onComplete: showResponse
	});
}
else
  $("id"+pageid).style.display="block";

}
function showResponse(originalRequest)
{
//put returned XML in the textarea
//$('result').value = originalRequest.responseText;
$("execing").style.display="none";
var rlStr=originalRequest.responseText;
var divname=rlStr.substring(0,rlStr.indexOf("<table"));
//alert(divname);
//alert(rlStr.substring(rlStr.indexOf("<table"),rlStr.length));
$(divname).style.display="block";
$(divname).innerHTML=rlStr.substring(rlStr.indexOf("<table"),rlStr.length);
}
		</script>
	</head>
	<body>

		<html:form action="/custview">

			<div id="id0">
				<table width="880" cellspacing="0" cellpadding="0" border="0" align="center">
					<tbody>
						<tr>
							<td width="3" height="31">
								<img height="31" src="./images/table_01.gif" width="3" />
							</td>
							<td background="./images/table_02.gif" height="31">
								<table cellspacing="0" cellpadding="0" width="146" align="left"
									border="0">
									<tbody>
										<tr>
											<td width="51" background="./images/title_1_bg.gif">
												<img height="31" src="./images/title_1.gif" width="51" />
											</td>
											<td width="95" background="./images/title_1_bg.gif">
												<span class="color_b_666">客户统一视图</span>
											</td>
										</tr>
									</tbody>
								</table>
							</td>
							<td width="3">
								<img height="31" src="./images/table_03.gif" width="3" />
							</td>
						</tr>
						<tr>
							<td width="3"  width="3"
								align="right">
								
							</td>
							<td>
							<logic:present name="cimpagelist">
							<logic:iterate name="cimpagelist" id="i">
							
								<input type="button" value="<bean:write name="i" property="pageName" />" 
								   onclick="geninfo('<bean:write name="i" property="pageId" />')">
							
							</logic:iterate>
							</logic:present>
							</td>
							
						</tr>
			</table>
			</div>
			<br />
			<logic:present name="cimpagelist">
							<logic:iterate name="cimpagelist" id="i">
							
								<div id="id<bean:write name="i" property="pageId" />" align="center"></div>
							
							</logic:iterate>
			</logic:present>
			<div id="execing" align="center" style="display:none">
			  <table width='770' border='0' align='center' cellpadding='5' cellspacing='1' bgcolor='#FF9900' align='center'>
			  <tr></tr><img src="images/execing.gif" /> 正在查询数据，请稍候....
			  </table>
			</div>
			

		</html:form>
		<script language="javascript" type="text/javascript">		
             geninfo('<%=inst.getPageId()%>');
		</script>
	</body>
</html>

